package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.cucc.service.attr.LocalAttrHelper;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.MVProvZIPProtocolVersionAttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.annotation.AttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import org.springframework.stereotype.Service;

@Service
@AttrHandler(MVProvZIPProtocolVersionAttrHandler.class)
public class MVProvZIPProtocolVersionAttrLinkHandler extends AbstractAttrLinkageHandler<AttrData> {
    @Override
    public void handle(KiteAttr attr, KiteInst inst, AttrData data) {

    }

    @Override
    public void handleStyle(KiteAttr attr, KiteInst inst, AttrData data) {
        if ("1_0000219".equals(attr.getValue())) {
            // ipv4
            LocalAttrHelper.showForDAndNull(inst, "200002855");
            LocalAttrHelper.hideAndNullable(inst, "200002857");
        }
        else if ("1_0000220".equals(attr.getValue())) {
            // ipv6
            LocalAttrHelper.hideAndNullable(inst, "200002855");
            LocalAttrHelper.showForDAndNull(inst, "200002857");
        }
        else if ("1_0000221".equals(attr.getValue())) {
            // ipv4/v6双栈
            LocalAttrHelper.showForDAndNull(inst, "200002855","200002857");
        }
    }
}
